<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title>添加类别</title>
	<script type="text/javascript" src="scripts/boot.js"></script>
</head>
<body style="border: 0px; margin: 0px; padding: 0px;width: 100%;height: 100%">
 	<div id="form1" style="padding: 5px">
			<table cellspacing="2px">
				<tr>
					<td>
						<lable>父节点名称：</lable>
					</td>
					<td>
						<input class="mini-hidden" id="pid" name="pid"/>
						<input id= "pname" name="pname" class="mini-textbox" required="true" />
					</td>
				</tr>
				<tr>
					<td>
						<lable>子节点名称：</lable>
					</td>
					<td>
						<input id="uname"  name="name" class="mini-textbox" required="false" emptyText="请输入名称" />
					</td>
				</tr>
				<tr>
					<td>
						<lable>描述信息：</lable>
					</td>
					<td>
						<textarea id="descpt" name="descpt" class="mini-textarea" emptyText="请输入描述信息" ></textarea>
					</td>
				</tr>
				<tr>
					<td>&nbsp;</td><td>&nbsp;</td>
				</tr>
				<tr align="center">
					<td colspan="2">
	                  <input value="保存" type="button" onclick="onOk()" />
	                  <input  value="取消" type="button" onclick="onCancel()" />
	              	</td>
				</tr>
			</table>
	</div>
<script type="text/javascript">
	mini.parse();
	var form = new mini.Form("form1");
	
	//标准方法接口定义
    function SetData(data) {
      //跨页面传递的数据对象，克隆后才可以安全使用
      data = mini.clone(data);
      mini.get(pname).setValue(data.name);
      mini.get(pid).setValue(data.id);
    }
	
	function saveData() {
		 var o = form.getData(); 
		    form.validate();
		    if (form.isValid() == false) return;
		    $.ajax({
		        url: "call_health_save.do",
				type: 'post',
				dataType: 'json',
		        data: o,
		        cache: false,
		        success: function (text) {
		            if(text.success){
		            	window.CloseOwnerWindow("succ");
		            }else{
		            	mini.showTips({content:text.message,state:'danger',x:'center',y:'top'});
		            }
		        }
		    });
	}
	
	//添加节点
	function onOk(){
		saveData();
	}
	
	function onCancel() {
		window.CloseOwnerWindow();
	}
</script>
</body>
</html>